package com.lam.system.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lam.system.entity.SysUserRole;

/**
 * 用户角色表 Mapper 接口
 */
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {

	@Select("select role_code from sys_role where id in (select role_id from sys_user_role where user_id = #{uid})")
	List<String> getRoleByUid(@Param("uid") String uid);

	/**
     * 根据角色ID删除角色与用户关系
     */
    int deleteByRoleId(@Param("roleId") String roleId, @Param("userIdList") List<String> userIdList);
    
    /**
     * 根据用户ID删除角色与用户关系
     */
    int deleteByUserId(@Param("userId") String userId, @Param("roleIdList") List<String> roleIdList);

}
